import grails.util.DomainBuilder

class BootStrap {

    def grailsApplication

    def init = { servletContext ->
        environments {
            development {
                def builder = new DomainBuilder()
                builder.classNameResolver = "grails.company"
                def org = builder.organization(title: 'ACME', description: 'Description string') {
                    department(title: 'Cartoons', description: 'Description string') {
                        project(title: 'Toy story', description: 'Description string') {
                            employee(
                                    firstName: 'George',
                                    lastName: 'Bush',
                                    emailAddress: 'george@ACME.com',
                                    accountName: 'gbush'
                            )
                        }
                    }
                    department(title: 'Cinema', description: 'No desc') {
                        project(title: 'Star Wars', description: 'No desc')
                    }
                }

                org.save()
            }
        }
    }

    def destroy = {
    }
}
